package com.ktwlsoft.fundmanage.domain.entity;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Getter;
import lombok.Setter;

import javax.persistence.*;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;

/**
 * 房屋关系人
 *
 * @author Zhuhe on 2019/8/20 10:45
 * @author LanJian
 * @version 1.0
 */
@ApiModel("房屋关系人-HouseRelatedPersonRepository")
@Entity
@Table(name = "house_related_person")
@Getter
@Setter
public class HouseRelatedPerson extends BaseEntity{

    /**主键*/
    @ApiModelProperty("主键")
    @Id
    @Column(name = "id",columnDefinition = "bigint(30) NOT NULL COMMENT '主键'")
    private Long id;

    /**交易编号*/
    @ApiModelProperty("交易编号")
    @Column(name = "ts_code",columnDefinition = "bigint(30) DEFAULT NULL COMMENT '交易编号'")
    private Long tsCode;

    /**人名*/
    @ApiModelProperty("人名")
    @Column(name = "name", length = 30)
    @Size(max = 30, message = "人名参数超长")
    @NotNull
    private String name;

    /**手机号*/
    @ApiModelProperty("手机号")
    @Column(name = "phone",columnDefinition = "varchar(40) DEFAULT NULL COMMENT '手机号'")
    @Size(max = 40, message = "手机号参数超长")
    private String phone;

    /**证件类别*/
    @ApiModelProperty("证件类别")
    @Column(length = 30)
    private String certificateType;

    /**证件号*/
    @ApiModelProperty("证件号")
    @Column(name = "certificate_number",columnDefinition = "varchar(30) DEFAULT NULL COMMENT '证件号'")
    @Size(max = 30, message = "证件号参数超长")
    private String certificateNumber;

    /**通讯地址*/
    @ApiModelProperty("通讯地址")
    @Column(name = "address",columnDefinition = "varchar(100) DEFAULT NULL COMMENT '通讯地址'")
    @Size(max = 100, message = "通讯地址参数超长")
    private String address;

    /**邮编*/
    @ApiModelProperty("邮编")
    @Column(name = "post_code",columnDefinition = "varchar(30) DEFAULT NULL COMMENT '邮编'")
    @Size(max = 10, message = "邮编参数超长")
    private String postCode;

    /**备注*/
    @ApiModelProperty("备注")
    @Column(name = "remark",columnDefinition = "varchar(100) DEFAULT NULL COMMENT '备注'")
    @Size(max = 100, message = "备注参数超长")
    private String remark;

    @ApiModelProperty("权利人类别")
    @Enumerated(EnumType.STRING)
    @Column(name = "related_type")
    private RelatedType relatedType;

    /**类型:SELLER.卖方,BUYER.买方*/
    @ApiModelProperty("类型:SELLER.卖方,BUYER.买方")
    @Column(name = "personnel_type",columnDefinition = "varchar(30) DEFAULT NULL COMMENT '类型:SELLER.卖方,BUYER.买方'")
    @Enumerated(EnumType.STRING)
    private PersonnelType personnelType;

    /**是否设置银行*/
    @ApiModelProperty("是否设置银行")
    @Column(columnDefinition = "bit DEFAULT 0 COMMENT '是否设置银行'")
    private Boolean isConfigBank;

    public enum PersonnelType{
        /**
         * 卖方
         */
        SELLER("卖方"),
        /**
         * 共享人
         */
        BUYER("买方");

        private String name;

        PersonnelType(String name){
            this.name = name;
        }
    }

    /**
     *  联系人类型
     */
    public enum RelatedType{
        /**
         * 权利人
         */
        OWNER("权利人"),
        /**
         * 共享人
         */
        SHARER("共享人"),
        /**
         * 代理人
         */
        AGENT("代理人"),
        /**
         * 监管人
         */
        CONSERVATOR("监管人"),

        /**
         * 其他缴款人
         */
        OTHER("其他缴款人");

        private String name;

        RelatedType(String name){
            this.name = name;
        }
    }

    /**
     * 证件类型
     */
    public enum CertificateType{
        /**
         * 身份证
         */
        @ApiModelProperty("身份证")
        ID_CARD(10),

        /**
         * 营业执照
         */
        @ApiModelProperty("营业执照")
        BUSINESS_LISCENSE(21),
        /**
         * 护照
         */
        @ApiModelProperty("护照")
        PASSPORT(19),

        /**
         * 台湾同胞
         */
        @ApiModelProperty("台湾同胞")
        TAIWAN_COMPATROIT(13);

        private int code;

        private CertificateType(int code){
            this.code = code;
        }
    }

}